﻿using System;

namespace SMBL
{
    namespace ConfigElement.DBProvider
    {
        /// <summary>
        /// The Database Provider Defined in
        /// Config.dtd
        /// @Author: Push
        /// </summary>
        public enum ProviderType
        {
            // Failed to get an Provider
            EMPTY,
            // Microsoft SQL Server 2000/2005
            // The Provider Class Name also is SQLDB
            SQLDB,
            // Microsoft Access Database 2000-2003
            // The Provider Class Name also is OLEDB
            OLEDB,
            // MySQL Database
            MYSQL,
            // Oracle Database
            ORACLE
        }

        /// <summary>
        /// Convert String to Provider Type
        /// @Author: Push
        /// </summary>
        public class ConvertToType
        {
            /// <summary>
            /// Convert the string to the provider type
            /// @Author: Push
            /// </summary>
            /// <param name="theType"></param>
            /// <returns></returns>
            public static ProviderType Convert(String theType)
            {
                switch (theType)
                {
                    case "SQLDB": return ProviderType.SQLDB;
                    case "OLEDB": return ProviderType.OLEDB;
                    case "MYSQL": return ProviderType.MYSQL;
                    case "ORACLE": return ProviderType.ORACLE;
                    default: return ProviderType.EMPTY;
                }
            }
        }
    }
}